﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using University.Workshop.Model;
using University.Workshop.DataAccess;
using University.Workshop.Business;
using System.Collections.ObjectModel;

namespace University.Workshop.WebApp
{
    public partial class AllAuction : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Collection<ProductAuction> list = AllAuctionManager.ShowAllAuctions();
                if (list != null)
                {
                    DataList1.DataSource = list;
                    DataList1.DataBind();
                }
                else
                {
                    errorlb.Visible = true;
                    errorlb.ForeColor = System.Drawing.Color.Blue;
                    errorlb.Text = "There's no auction available this momment";
                }
            }
        }

        protected void SelectBtn_Click(object sender, EventArgs e)
        {
            Button b= sender as Button;
            Response.Redirect("Bid.aspx?id=" + b.CommandArgument);

        }


        protected void LinkButton1_Click1(object sender, EventArgs e)
        {
            LinkButton b = sender as LinkButton;
            Response.Redirect("Bid.aspx?id=" + b.CommandArgument);
        }

    }
}